<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div></div>
</body>
<script>
    const sse = new EventSource("http://localhost:3001/sse");
    sse.addEventListener('start', (event) => {
        console.log('---------- start');
      const messageElement = document.createElement('div');
      messageElement.textContent = `Greeting: ${event.data}`;
      document.body.appendChild(messageElement);
    });
    sse.onmessage = (message)=>{
        console.log('message: ', message);
    }

    sse.onerror = (error)=>{
        console.log('error: ', error);
        sse.close();

    }
</script>
</html>